package com.aloha.springframework.test.event;

import com.aloha.springframework.context.ApplicationContext;
import com.aloha.springframework.context.ApplicationListener;
import com.aloha.springframework.context.event.ContextRefreshedEvent;

/**
 * @author DaiZhiHeng
 * @date 2023/7/4 8:34
 */
public class ContextRefreshedEventListener implements ApplicationListener<ContextRefreshedEvent> {

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        ApplicationContext context = event.getApplicationContext();
        System.out.println("容器刷新完毕, " + "获取用户自定义的监听器："
                + context.getBean("customerListener").getClass().getSimpleName());
    }
}
